#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
@Time        : 2021/11/9 17:19
@Author      : Albert Darren
@Contact     : 2563491540@qq.com
@File        : human_morphology.py
@Version     : Version 1.0.0
@Description : TODO
@Created By  : PyCharm
"""
import numpy as np
from copy import deepcopy
from skimage.morphology import square, opening, erosion, dilation

A = np.zeros((6, 6))
A[[1, 1, 2, 2, 2, 3, 3, 3, 4, 4], [1, 3, 1, 2, 3, 1, 2, 3, 2, 3]] = 1
B = deepcopy(A)
sq_elem = square(width=2)
sq_elem[0, 1] = 0
open_a = opening(A, sq_elem)
print(A, open_a, sep='\n')
C = erosion(B, sq_elem)
print(C, dilation(C, sq_elem, shift_x=True, shift_y=True), sep='\n')
